<?php

#require_once 'PHPUnit/Framework/TestCase.php';
 apf_require_class('Tools_Tools');
 class Oa_Test_Util_ToolsTest extends PHPUnit_Framework_TestCase {

    private $tools;
    public function setUp(){
        $this->tools = Tools_Tools::get_instance();
    }
    public function tearDown(){

    }
    /**
     * @dataProvider data_company_year
     */
    public function test_company_year($param_year,$expect_result){
        $temp = $this->tools->company_year($param_year);
        $this->assertEquals($temp,$expect_result);
    }
    /**
     * @dataProvider data_annual_format
     */
    public function test_annual_format($param_enterdate,$expect_result){
        //$temp = $this->tools->annual_format($param_enterdate);
        //$this->assertEquals($temp,$expect_result);
        $this->assertTrue(TRUE);
    }
    public function test_caculate_basic(){
        $this->assertTrue(TRUE);
    }
    /**
     * @depends test_annual_format
     * @depends test_caculate_basic
     * @dataProvider data_annual
     */
    public function test_annual($param_enterdate,$expect_result){
        $temp = $this->tools->annual($param_enterdate);
        $this->assertEquals($temp,$expect_result);
    }

    //------------assert--------------//
    private function assert_tools($method,$assert,$params,$expect){
        $temp = $this->tools->$method($params);
        $this->$assert($temp,$expect);
    }
    //------------data---------------//
    public function data_company_year(){
       return
        array(
           array(2012,array(2012)),
           array(2010,array(2012,2011,2010)),
           array(2006,array(2012,2011,2010,2009,2008,2007)),
           array(2013,array()),
           //array('',  array()),
           //array('abcd',array())
        );
    }
    public function data_annual_format(){
        return
            array(
                array(strtotime('2012-11-05 10:10:10'),''),
                array(strtotime('2011-11-05 10:10:10'),7),
                array(strtotime('2013-11-05 10:10:10'),'')
             );
    }
    public function data_annual(){
        return
        array(
                array(strtotime('2012-11-05 10:10:10'),''),
                array(strtotime('2011-11-05 10:10:10'),7),
                array(strtotime('2013-11-05 10:10:10'),''),
                array('',''),
                array('ftuy','')
        );
    }
}